#include <stdbool.h>
#include <stdio.h>

bool canJump(int *nums, int numsSize) {
    int i = 0;
    int cover = 0;//覆盖范围--最远能跳到我位置的下标
    while (i <= cover) {//覆盖的范围包括边界上的位置
        if (cover >= numsSize - 1) {
            return 1;
        }
        if (nums[i] + i > cover) {
            cover = nums[i] + i;
        }
        i++;
    }

    return 0;
}

int main() {
    int test[5] = {2, 3, 1, 1, 4};
    bool ret = canJump(test, 5);
    printf("%d", ret);
}